import React from 'react'
import propsType from 'prop-types'
import btn from './button.module.css'

export default class Button extends React.Component{
    static defaultProps={
        click:()=>{},
        style:{},
        type:'default',
        size:'default',
        disabled:false,
        // text:'按钮'
    }
    static propType={
        click:propsType.func,
        size:propsType.string,
        type:propsType.string,
        // text:propsType.string,
        style:propsType.object,
        disabled:propsType.bool,
    }
    getClass=(type,size)=>{
        if(type==='circle'){
            if(size==='small'){
                return 'btn-cicle-small'
            }else{
                return 'btn-circle-big'
            }
        }else{
            if(size==='small'){
                return 'btn-default-small'
            }else{
                return 'btn-default-big'
            }
        }
    }
    render(){
        let {children,disabled,type,size}=this.props
        return (
            <div>
                <button
                disabled={disabled}
                className={btn[this.getClass(type,size)]}
                >{children?children:'按钮'}</button>
            </div>
        )
    }
}